Insert Method

Inserts a new element into an array.

Syntax



array.Insert index, value


Notes

All items below and including index are moved down one position to make room for the new element.

The Insert method works with one-dimensional arrays only.


Examples

This example inserts a new element at position 5 into the array aNames and assigns it the string "Bill".

aNames.Insert 5, "Bill"

See Also

Append, Array, IndexOf, Pop, Redim, Remove, Shuffle, Sort, Sortwith methods; Dim, Redim statements; Ubound function.